using UnityEngine;

public class PlayerState_Dash : PlayerState
{
    public PlayerState_Dash(Player player, PlayerStateMachine stateMachine, string animBoolName) : base(player, stateMachine, animBoolName)
    {
    }


    public override void Enter()
    {
        base.Enter();
        player.movement.SetGravity(false);
        stateTimer = player.dashDuration;
    }

    public override void Exit()
    {
        base.Exit();
        player.movement.SetGravity(true);
        player.movement.AddMovement(Vector3.zero);
    }

    public override void Update()
    {
        base.Update(); 
        
        player.movement.Dash();
        if (stateTimer <= 0)
        {
            stateMachine.ChangeState(player.idleState);
        }
    }
}
